package com.xiaocai.myblog.controller;

import com.xiaocai.myblog.common.ResponseData;
import com.xiaocai.myblog.common.SuccessResponseData;
import com.xiaocai.myblog.services.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenhefu
 * @date 2019-09-30 21:42
 */
@RestController
public class EmailController {

    @Autowired
    private EmailService emailService;

    @RequestMapping(value = "/api/v1/email/send",method = RequestMethod.GET)
    public ResponseData<Boolean> sendCode(@RequestParam String email){

        boolean isSuccess = emailService.sendCode(email);

        return SuccessResponseData.getSuccessData(isSuccess);
    }
}
